<template>
	<view class="y">
		<view class="tou1">
			<uni-easyinput focus="false" placeholder="请输入账号" prefixIcon="person" v-model="username"></uni-easyinput>
		</view>
		<view class="tou3">
			<uni-easyinput placeholder="请输入密码" prefixIcon="locked" type="password" maxlength="11"
				v-model="password"></uni-easyinput>
		</view>
		<view class="denglu" @click="deng">登录</view>
		<view class="zhuce">
			<p @click="zhu">注册</p>
			<p>找回密码</p>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: 'user123',
				password: 'user123'
			}
		},
		methods: {
			deng() {
				this.$api.post("/wx/auth/login", {
					username: this.username,
					password: this.password
				}).then(res => {
					// debugger
					uni.setStorageSync('token', res.data.token) //可登录,如果不是setStorageSync的话存不进数据
					// uni.setStorageSync('token', data.data.token) // 不可登录
					uni.switchTab({
						url: '/pages/index/index',
					})
				})
			},
			zhu() {
				uni.navigateTo({
					url: '../zhuce/regie1'

				})
			}

		}
	}
</script>

<style>
	.x {
		display: flex;
		/* 打开弹性布局 */
		flex-direction: row;
		/* 横 */

	}

	.y {
		display: flex;
		/* 打开弹性布局 */
		flex-direction: column;
		/* 竖 */
	}

	.tou1 {
		width: 600rpx;
		margin: 0 auto;
		margin-top: 10rpx;
	}

	.tou3 {
		width: 600rpx;
		margin: 0 auto;
		margin-top: 10rpx;
	}

	.denglu {
		display: flex;
		justify-content: center;
		padding-top: 7rpx;
		width: 150rpx;
		height: 50rpx;
		background-color: lightgreen;
		border-radius: 40rpx;
		margin: auto;
		margin-top: 10rpx;
	}

	.zhuce {
		display: flex;
		flex-direction: column;
		flex-direction: row;
		justify-content: space-around;
		font-size: 25rpx;

	}
</style>